from abc import ABC, abstractmethod
from io import BytesIO


class CaptchaService(ABC):

    @abstractmethod
    def create(self) -> tuple[BytesIO, str]:
        """
        生成验证码
        :return: 图片和验证码文本
        """
        pass

    @abstractmethod
    def verify(self, key: str, code: str) -> bool:
        """
        验证码验证
        :param key: 验证码 key
        :param code: 用户输入的验证码文本
        :return: 是否验证通过
        """
        pass
